#!/usr/bin/env python 
'''
Copyright (C) 2007

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
'''
import sys, os
sys.path.append(os.path.dirname(sys.argv[0]))  #?

import inkex, simplepath, sys

class GameData(inkex.Effect):
    def __init__(self):
        inkex.Effect.__init__(self)
        self.OptionParser.add_option("--name", 
                action="store", type="string",
                dest="name", default="ObjName",
                help="Name of the Object Type in game")
        self.OptionParser.add_option("--mass", 
                action="store", type="float",
                dest="mass", default="10.0",
                help="Mass of the Object in game")
        self.OptionParser.add_option("--elasticity", 
                action="store", type="float",
                dest="elasticity", default="1.0",
                help="elasticity of the Object in game")
        self.OptionParser.add_option("--shape", 
                action="store", type="string",
                dest="shape", default="circle",
                help="bounding box info of the Object in game")

        self.OptionParser.add_option("--collision", 
                action="store", type="string",
                dest="collision", default="solid",
                help="sensor or normal object?")


    def effect(self):
        for id, node in self.selected.iteritems():
            node.set('name', self.options.name)
            node.set('mass', str(self.options.mass))
            #node.set('collision', self.options.collision)
            #node.set('elasticity', str(self.options.elasticity))
            node.set('shape', self.options.shape+":"+self.options.collision+":"+str(self.options.elasticity))


if __name__ == '__main__':   #pragma: no cover
    e = GameData()
    e.affect()
